package net.mcreator.playerhuds.procedure;

import net.minecraft.potion.PotionEffect;
import net.minecraft.init.MobEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.Entity;

import net.mcreator.playerhuds.ElementsPlayerhudsMod;

import java.util.Map;
import java.util.Collection;

@ElementsPlayerhudsMod.ModElement.Tag
public class ProcedureArmorHudBShowAndHide extends ElementsPlayerhudsMod.ModElement {
	public ProcedureArmorHudBShowAndHide(ElementsPlayerhudsMod instance) {
		super(instance, 6);
	}

	public static boolean executeProcedure(Map<String, Object> dependencies) {
		if (dependencies.get("entity") == null) {
			System.err.println("Failed to load dependency entity for procedure ArmorHudBShowAndHide!");
			return false;
		}
		Entity entity = (Entity) dependencies.get("entity");
		if ((((((entity instanceof EntityLivingBase) ? ((EntityLivingBase) entity).getTotalArmorValue() : 0) > 0) && (new Object() {
			boolean check() {
				if (entity instanceof EntityLivingBase) {
					Collection<PotionEffect> effects = ((EntityLivingBase) entity).getActivePotionEffects();
					for (PotionEffect effect : effects) {
						if (effect.getPotion() == MobEffects.ABSORPTION)
							return true;
					}
				}
				return false;
			}
		}.check())) && (!((entity instanceof EntityPlayer) ? ((EntityPlayer) entity).capabilities.isCreativeMode : false)))) {
			return (true);
		}
		return (false);
	}
}
